#include <key.h>
#include <stdio.h>
#include <string.h>
#include <stdlib.h>
#include "device.h"
#include "console.h"

void command_kbd(int argc, const char **argv)
{
        int key;
        if (argc == 1) {
                do {
                        key = kb_get_key(0);
                        if (key > 0) {
                                printf("[%02x] ", key);
                                if (key == KEY_ESC) {
                                        printf("\n");
                                        return;
                                }
                        }
                }while (1);
        }
        else if (argc == 2) {
                key = strtoul(argv[1], NULL, 10);
                printf("Try to wait %d seconds\n", key);
                kb_get_key(key);
        }
}
const command_t kbd_cmd __command_entry = {
        "kbd",
        command_kbd,
        "kbd -- Keyboard Test"
};

